<template>
  <el-table :data="exams" style="width: 100%"
            :header-cell-style="{ 'text-align': 'center' }"
            :cell-style="{ 'text-align': 'center' }">
    <el-table-column prop="id" label="#ID"></el-table-column>
    <el-table-column label="姓名">
      <template slot-scope="scope">
        {{ user.name }}
      </template>
    </el-table-column>
    <el-table-column label="手机">
      <template slot-scope="scope">
        {{ user.phoneNum }}
      </template>
    </el-table-column>
    <el-table-column label="学年">
      <template slot-scope="scope">
        {{ `第${chineseNum(scope.row.academicYear)}学年` }}
      </template>
    </el-table-column>
    <el-table-column label="体检日期" prop="createTime"></el-table-column>


    <el-table-column label="操作">
      <template slot-scope="scope">

        <el-tooltip class="item" effect="dark" :content="'详情'" placement="top">
          <el-button type="warning" icon="el-icon-view" size="small" @click="showInfo(scope.row)" circle></el-button>
        </el-tooltip>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import {mapGetters} from 'vuex'
import {toChinesNum} from "@/utils/ymm";

export default {
  props: {
    exams: {
      type: Array,
      require: true
    }
  },
  methods: {
    showInfo(exam) {
      this.$emit('showInfo', exam)
    },
    chineseNum(num) {
      return toChinesNum(num)
    }
  },
  computed: {
    ...mapGetters(['user'])
  }
}
</script>

<style scoped>

</style>
